package com.link2room.aeriabots.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Created by Nakisa on 2016/11/16.
 */
@Entity
@Table(name = "payment_log")
@DynamicInsert
public class PaymentLog extends BaseEntity{
    private String openid;
    private String channel;
    private String outTradeNo;
    private String arkResult;
    private String tradeNo;
    private String l2RNo;
    private BigDecimal amount;

    @Basic
    @Column(name = "openid", nullable = true, length = 64)
    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }
    @Basic
    @Column(name = "channel", nullable = true, length = 32)
    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    @Basic
    @Column(name = "out_trade_no", nullable = true, length = 32)
    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    @Basic
    @Column(name = "ark_result", nullable = true, length = 2)
    public String getArkResult() {
        return arkResult;
    }

    public void setArkResult(String arkResult) {
        this.arkResult = arkResult;
    }

    @Basic
    @Column(name = "trade_no", nullable = true, length = 64)
    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    @Basic
    @Column(name = "l2r_no", nullable = true, length = 32)
    public String getL2RNo() {
        return l2RNo;
    }

    public void setL2RNo(String l2RNo) {
        this.l2RNo = l2RNo;
    }
    @Basic
    @Column(name = "amount", nullable = true,  precision = 12,scale = 2)
    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PaymentLog that = (PaymentLog) o;

        if (!openid.equals(that.openid)) return false;
        if (!channel.equals(that.channel)) return false;
        if (outTradeNo != null ? !outTradeNo.equals(that.outTradeNo) : that.outTradeNo != null) return false;
        if (!arkResult.equals(that.arkResult)) return false;
        if (!tradeNo.equals(that.tradeNo)) return false;
        if (!l2RNo.equals(that.l2RNo)) return false;
        return amount.equals(that.amount);
    }

    @Override
    public int hashCode() {
        int result = openid.hashCode();
        result = 31 * result + channel.hashCode();
        result = 31 * result + (outTradeNo != null ? outTradeNo.hashCode() : 0);
        result = 31 * result + arkResult.hashCode();
        result = 31 * result + tradeNo.hashCode();
        result = 31 * result + l2RNo.hashCode();
        result = 31 * result + amount.hashCode();
        return result;
    }
}
